﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Green.AgileMapper
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class CollectionMappingAttribute : MappingBaseAttribute
    {
        public string Name
        { get; set; }

        /// <summary>
        /// 是否删除to中不存在于from中的item项
        /// </summary>
        public bool IsDeleteNotInFromItem
        { get; set; }

        public bool IsConvertTo
        { get;  set; }

        public bool IsConvertFrom
        { get;  set; }

        /// <summary>
        /// fromObjItem list和domainObjItem list相等的表达式（fromObjItem,domainObjItem）=>retun bool;
        /// </summary>
        public string EqualExpression
        {
            get;
            set;
        }

        public CollectionMappingAttribute(string name, string fromIdentity, string toIdentity)
        {
            this.IsConvertFrom = this.IsConvertTo = true;
            this.Name = name;
            this.IsDeleteNotInFromItem = true;
        }
      

        public CollectionMappingAttribute()
            : this(null, null, null)
        {

        }
    }
}
